Re: [SQL] OUTER JOINS

Поиск
Список
Период
Сортировка
От Herouth Maoz
Тема Re: [SQL] OUTER JOINS
Дата
Msg-id l03130305b34cd633efee@[147.233.159.109]
обсуждение исходный текст
Ответ на Re: [SQL] OUTER JOINS  (Dan Janowski <danj@3skel.com>)
Список pgsql-sql
At 16:26 +0300 on 19/04/1999, Dan Janowski wrote:


> Thanks for giving it a stab. Looking at the available
> operators,
> there is no =* or *= ops available. Although I am curious
> where it
> comes from.

To the best of my knowledge, outer joins are not yet supported in
PostgreSQL. As far as I recall, you can achieve the same effect with a
union.

For example, if you have a people table and a pets table, where each
person's pet is joined to the owner by the owner's id colum, you'll
theoretically do something like:
 SELECT surname, firstname, pet_name FROM people, pets WHERE id *= owner_id ORDER BY surname, firstname;

So instead, you'll have to do something like:
 SELECT surname, firstname, pet_name FROM people, pets WHERE id = owner_id UNION SELECT surname, firstname, null FROM
peopleWHERE not exist (    SELECT 1    FROM pets    WHERE owner_id = id ) ORDER BY surname, firstname;
 

Excuse me if I goofed something syntactically, I don't have time to
actually create the tables and test the above. Note, however, that a UNION
removes duplicates.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma




В списке pgsql-sql по дате отправления:

Предыдущее
От: Nuchanard Chiannilkulchai
Дата:
Сообщение: Re: [SQL] substring
Следующее
От: Eric Vernichon
Дата:
Сообщение: